<!DOCTYPE html>
<html lang="en">
<head>
    
    <meta charset="utf-8">
    <title>objects/core/settlement.js - Civitas game</title>
    
    <meta name="description" content="Civitas is an empire-building game written in Javascript with the help of the jQuery library." />
    
    
    
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
    <script src="scripts/nav.js" defer></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav >
    
    <input type="text" id="nav-search" placeholder="Search" />
    
    <h2><a href="index.html">Home</a></h2><h2><a href="https://sizeof.cat" target="_blank" class="menu-item" id="site_link" >sizeof(cat)</a></h2><h2><a href="https://github.com/sizeofcat/civitas" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="civitas.controls.modal.html">modal</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.controls.modal.html#alert">alert</a></li><li data-type='method' style='display: none;'><a href="civitas.controls.modal.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.controls.modal.html#on_click">on_click</a></li></ul></li><li><a href="civitas.controls.panel.html">panel</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.controls.panel.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.controls.panel.html#destroy">destroy</a></li></ul></li><li><a href="civitas.controls.window.html">window</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.controls.window.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.controls.window.html#destroy">destroy</a></li><li data-type='method' style='display: none;'><a href="civitas.controls.window.html#handle">handle</a></li><li data-type='method' style='display: none;'><a href="civitas.controls.window.html#id">id</a></li></ul></li><li><a href="civitas.game.html">game</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.game.html#achievement_points">achievement_points</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#achievements">achievements</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#achievements_process">achievements_process</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#add_random_place">add_random_place</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#add_random_settlement">add_random_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#add_settlement">add_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#advice">advice</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#auctioneer">auctioneer</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#auctioneer_add">auctioneer_add</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#auctioneer_delete">auctioneer_delete</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#auctioneer_process">auctioneer_process</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#auctioneer_reset">auctioneer_reset</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#black_market">black_market</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#black_market_add">black_market_add</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#black_market_delete">black_market_delete</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#black_market_reset">black_market_reset</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#date">date</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#decrypt">decrypt</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#difficulty">difficulty</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#disband_city">disband_city</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#do_achievement">do_achievement</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#do_research">do_research</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#encrypt">encrypt</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#export">export</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#format_date">format_date</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#generate_random_army">generate_random_army</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#generate_random_navy">generate_random_navy</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#generate_random_resources">generate_random_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#generate_random_settlement_data">generate_random_settlement_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_achievement_config_data">get_achievement_config_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_building_config_data">get_building_config_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_buildings_for_settlement">get_buildings_for_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_hero_config_data">get_hero_config_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_num_settlements">get_num_settlements</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_place">get_place</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_prod_modifier">get_prod_modifier</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_random_nationality">get_random_nationality</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_random_personality">get_random_personality</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_random_religion">get_random_religion</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_random_resource">get_random_resource</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_research_config_data">get_research_config_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_settings">get_settings</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_settlement">get_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_settlements">get_settlements</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_storage_data">get_storage_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#get_tax_modifier">get_tax_modifier</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#has_achievement">has_achievement</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#has_research">has_research</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#has_research_in_queue">has_research_in_queue</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#has_storage_data">has_storage_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#import">import</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#in_queue">in_queue</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#is_autumn">is_autumn</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#is_paused">is_paused</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#is_spring">is_spring</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#is_summer">is_summer</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#is_winter">is_winter</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#level_to_fame">level_to_fame</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#level_up">level_up</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#load_game_data">load_game_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#mode">mode</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#new_game">new_game</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#pause">pause</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#queue">queue</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#queue_add">queue_add</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#queue_process_action">queue_process_action</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#queue_remove_action">queue_remove_action</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#refresh_trades">refresh_trades</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#research">research</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#reset_storage_data">reset_storage_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#save">save</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#save_and_refresh">save_and_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#season">season</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#set_settings">set_settings</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#set_storage_data">set_storage_data</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#ui">ui</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#unpause">unpause</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#version">version</a></li><li data-type='method' style='display: none;'><a href="civitas.game.html#world">world</a></li></ul></li><li><a href="civitas.modules.ai.html">ai</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.modules.ai.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.ai.html#process">process</a></li></ul></li><li><a href="civitas.modules.api.html">api</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#_request">_request</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#api_version">api_version</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#city_info">city_info</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#do_export">do_export</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#do_import">do_import</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#heartbeat">heartbeat</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#login">login</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#logout">logout</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.api.html#register">register</a></li></ul></li><li><a href="civitas.modules.jailer.html">jailer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.modules.jailer.html#check">check</a></li><li data-type='method' style='display: none;'><a href="civitas.modules.jailer.html#core">core</a></li></ul></li><li><a href="civitas.objects.battleground.html">battleground</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#add">add</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#attack">attack</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#distance">distance</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#end_turn">end_turn</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#grid">grid</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#highlight_cells">highlight_cells</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#log">log</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#move">move</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#num_turns">num_turns</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#on_attack">on_attack</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#on_end_turn">on_end_turn</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#on_lose">on_lose</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#on_move">on_move</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#on_select">on_select</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#on_win">on_win</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#properties">properties</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#redraw">redraw</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.battleground.html#show_stats">show_stats</a></li></ul></li><li><a href="civitas.objects.building.html">building</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#demolish">demolish</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#downgrade">downgrade</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_building_data">get_building_data</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_handle">get_handle</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_level">get_level</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_name">get_name</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_settlement">get_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_settlement_resources">get_settlement_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_tax_amount">get_tax_amount</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_type">get_type</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#get_upgrade_costs">get_upgrade_costs</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#has_building_requirements">has_building_requirements</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#has_problems">has_problems</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#has_requirements">has_requirements</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#has_research_requirements">has_research_requirements</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#has_settlement_requirements">has_settlement_requirements</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_downgradable">is_downgradable</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_housing_building">is_housing_building</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_marketplace">is_marketplace</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_municipal_building">is_municipal_building</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_production_building">is_production_building</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_stopped">is_stopped</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#is_upgradable">is_upgradable</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#log_to_console">log_to_console</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#notify">notify</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#position">position</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#process">process</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#produce">produce</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#set_level">set_level</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#start_production">start_production</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#stop_production">stop_production</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#tax">tax</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.building.html#upgrade">upgrade</a></li></ul></li><li><a href="civitas.objects.event.html">event</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.event.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.event.html#process">process</a></li></ul></li><li><a href="civitas.objects.hero.html">hero</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.hero.html#core">core</a></li></ul></li><li><a href="civitas.objects.place.html">place</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#export">export</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#id">id</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#location">location</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#name">name</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#properties">properties</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.place.html#resources">resources</a></li></ul></li><li><a href="civitas.objects.settlement.html">settlement</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#add_to_storage">add_to_storage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#adjust_campaign_cost">adjust_campaign_cost</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#ai">ai</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#build">build</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#buy_from_settlement">buy_from_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#can_build_ships">can_build_ships</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#can_diplomacy">can_diplomacy</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#can_recruit_heroes">can_recruit_heroes</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#can_recruit_soldiers">can_recruit_soldiers</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#can_research">can_research</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#can_trade">can_trade</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#change_religion">change_religion</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#climate">climate</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#coins">coins</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#color">color</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#dec_coins">dec_coins</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#diplomacy">diplomacy</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#disband_ship">disband_ship</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#disband_soldier">disband_soldier</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#espionage">espionage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#export">export</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#export_buildings">export_buildings</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#faith">faith</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#fame">fame</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_army">get_army</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_building">get_building</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_building_data">get_building_data</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_buildings">get_buildings</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_diplomacy_status">get_diplomacy_status</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_influence_with_settlement">get_influence_with_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_navy">get_navy</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_properties">get_properties</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_rank">get_rank</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_resources">get_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_spoils">get_spoils</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_trades">get_trades</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_trades_exports">get_trades_exports</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_trades_imports">get_trades_imports</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#get_type">get_type</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_any_resources">has_any_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_coins">has_coins</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_resource">has_resource</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_resources">has_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_same_nationality">has_same_nationality</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_ships">has_ships</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_soldiers">has_soldiers</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#has_storage_space_for">has_storage_space_for</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#heroes">heroes</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#icon">icon</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#id">id</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#inc_coins">inc_coins</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_building_built">is_building_built</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_camp">is_camp</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_city">is_city</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_mercenary_recruited">is_mercenary_recruited</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_metropolis">is_metropolis</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_player">is_player</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_urban">is_urban</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#is_village">is_village</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#level">level</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#level_up">level_up</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#load_army">load_army</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#location">location</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#lower_espionage">lower_espionage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#lower_faith">lower_faith</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#lower_fame">lower_fame</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#lower_influence">lower_influence</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#lower_prestige">lower_prestige</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#lower_research">lower_research</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#mercenary">mercenary</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#merge_army">merge_army</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#merge_navy">merge_navy</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#merge_resources">merge_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#name">name</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#nationality">nationality</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#nice_name">nice_name</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#num_ships">num_ships</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#num_soldiers">num_soldiers</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#personality">personality</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#population">population</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#prestige">prestige</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#raise_espionage">raise_espionage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#raise_faith">raise_faith</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#raise_fame">raise_fame</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#raise_influence">raise_influence</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#raise_prestige">raise_prestige</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#raise_research">raise_research</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#recruit_mercenary_army">recruit_mercenary_army</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#recruit_ship">recruit_ship</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#recruit_soldier">recruit_soldier</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#refresh_heroes">refresh_heroes</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#release_mercenaries">release_mercenaries</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#release_mercenary">release_mercenary</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#religion">religion</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#remove_from_exports">remove_from_exports</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#remove_from_imports">remove_from_imports</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#remove_resource">remove_resource</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#remove_resources">remove_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#rename">rename</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#research">research</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_espionage">reset_espionage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_faith">reset_faith</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_fame">reset_fame</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_influence">reset_influence</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_prestige">reset_prestige</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_research">reset_research</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#reset_trades">reset_trades</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#ruler">ruler</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#sell_to_settlement">sell_to_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#set_army">set_army</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#set_influence">set_influence</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#set_navy">set_navy</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#set_resources">set_resources</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#set_trades">set_trades</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#setup_initial_buildings">setup_initial_buildings</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#split_army">split_army</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#split_navy">split_navy</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#status">status</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#storage">storage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#to_camp">to_camp</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#to_city">to_city</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#to_metropolis">to_metropolis</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#to_village">to_village</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.settlement.html#waterside">waterside</a></li></ul></li><li><a href="civitas.objects.ui.html">ui</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#army_img">army_img</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#army_list">army_list</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#build_main">build_main</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#building_element">building_element</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#building_panel">building_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#building_panel_template">building_panel_template</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#chance_panel">chance_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#check_storage">check_storage</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#citymap_scrollto_building">citymap_scrollto_building</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#close_panel">close_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#cost_panel">cost_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#error">error</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#generic_panel_template">generic_panel_template</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#get_cell_middle">get_cell_middle</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#get_cell_middle_coords">get_cell_middle_coords</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#get_panel">get_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#get_panels">get_panels</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#get_random_color">get_random_color</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#hide_loader">hide_loader</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#item_tooltip">item_tooltip</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#level_panel">level_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#log">log</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#materials_panel">materials_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#navy_img">navy_img</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#navy_list">navy_list</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#normal_panel">normal_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#notify">notify</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#open_modal">open_modal</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#open_panel">open_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#open_window">open_window</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#panel_btn">panel_btn</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#panel_exists">panel_exists</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#production_panel">production_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#progress">progress</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#refresh">refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#refresh_panels">refresh_panels</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#refresh_toolbar">refresh_toolbar</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#refresh_ui">refresh_ui</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#requires_panel">requires_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#resize">resize</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#resource_small_img">resource_small_img</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#resource_storage_el">resource_storage_el</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#resource_storage_small_el">resource_storage_small_el</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#show_loader">show_loader</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#storage_panel">storage_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#tabs">tabs</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#tax_panel">tax_panel</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#trades_list">trades_list</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#window_about_section">window_about_section</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#window_exists">window_exists</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.ui.html#worldmap_scrollto">worldmap_scrollto</a></li></ul></li><li><a href="civitas.objects.world.html">world</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#add_place">add_place</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#add_settlement">add_settlement</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#calc_neighbours">calc_neighbours</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#colors">colors</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#core">core</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#data">data</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#draw">draw</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_climate_from_terrain">get_climate_from_terrain</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_distance">get_distance</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_distance_in_days">get_distance_in_days</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_hex">get_hex</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_hex_elevation">get_hex_elevation</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_hex_moisture">get_hex_moisture</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_hex_terrain">get_hex_terrain</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_neighbours">get_neighbours</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_random_location">get_random_location</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#get_terrain_from_climate">get_terrain_from_climate</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#hex_is_locked">hex_is_locked</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#hex_is_water">hex_is_water</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#hex_locked_by">hex_locked_by</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#lock_hex">lock_hex</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#properties">properties</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#remove_city">remove_city</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#seed">seed</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#seeds">seeds</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#set_hex">set_hex</a></li><li data-type='method' style='display: none;'><a href="civitas.objects.world.html#unlock_hex">unlock_hex</a></li></ul></li></ul><h3>Mixins</h3><ul><li><a href="civitas.html">civitas</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.html#.ACHIEVEMENTS">ACHIEVEMENTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ACTION_BUILD_PLACE">ACTION_BUILD_PLACE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ACTION_CAMPAIGN">ACTION_CAMPAIGN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ACTION_DIPLOMACY">ACTION_DIPLOMACY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ACTION_RESEARCH">ACTION_RESEARCH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.API_ENTRY_POINT">API_ENTRY_POINT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.API_URL">API_URL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.API_VERSION">API_VERSION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ARMOR_TYPE_CLOTH">ARMOR_TYPE_CLOTH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ARMOR_TYPE_LEATHER">ARMOR_TYPE_LEATHER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ARMOR_TYPE_MAIL">ARMOR_TYPE_MAIL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ARMOR_TYPE_PLATE">ARMOR_TYPE_PLATE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ARMY_COSTS">ARMY_COSTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ASSETS_URL">ASSETS_URL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.AUCTIONEER_DISCOUNT">AUCTIONEER_DISCOUNT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.AUTOSTART_MUSIC">AUTOSTART_MUSIC</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.AVATARS">AVATARS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.BATTLEGROUND_ATTACK">BATTLEGROUND_ATTACK</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.BATTLEGROUND_DEFENSE">BATTLEGROUND_DEFENSE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.BLACK_MARKET_DISCOUNT">BLACK_MARKET_DISCOUNT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.BUILDINGS">BUILDINGS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.BUILDINGS_ALL">BUILDINGS_ALL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.BUILDINGS_CATEGORIES">BUILDINGS_CATEGORIES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CAMP">CAMP</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CAMPAIGN_ARMY">CAMPAIGN_ARMY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CAMPAIGN_ARMY_RETURN">CAMPAIGN_ARMY_RETURN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CAMPAIGN_CARAVAN">CAMPAIGN_CARAVAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CAMPAIGN_SPY">CAMPAIGN_SPY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CARAVAN_COSTS">CARAVAN_COSTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CARAVAN_INFLUENCE">CARAVAN_INFLUENCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CITY">CITY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CLIMATE_ARID">CLIMATE_ARID</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CLIMATE_POLAR">CLIMATE_POLAR</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CLIMATE_TEMPERATE">CLIMATE_TEMPERATE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CLIMATE_TROPICAL">CLIMATE_TROPICAL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.CLIMATES">CLIMATES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DEBUG">DEBUG</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIFFICULTY_EASY">DIFFICULTY_EASY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIFFICULTY_HARD">DIFFICULTY_HARD</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIFFICULTY_HARDCORE">DIFFICULTY_HARDCORE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIFFICULTY_MEDIUM">DIFFICULTY_MEDIUM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACIES">DIPLOMACIES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_ALLIANCE">DIPLOMACY_ALLIANCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_CEASE_FIRE">DIPLOMACY_CEASE_FIRE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_PACT">DIPLOMACY_PACT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_PROPOSE_ALLIANCE">DIPLOMACY_PROPOSE_ALLIANCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_PROPOSE_CEASE_FIRE">DIPLOMACY_PROPOSE_CEASE_FIRE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_PROPOSE_JOIN">DIPLOMACY_PROPOSE_JOIN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_PROPOSE_PACT">DIPLOMACY_PROPOSE_PACT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_TRUCE">DIPLOMACY_TRUCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_VASSAL">DIPLOMACY_VASSAL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.DIPLOMACY_WAR">DIPLOMACY_WAR</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ENCRYPTION">ENCRYPTION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.EVENTS">EVENTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.EXPORT_INFLUENCE">EXPORT_INFLUENCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.EXPORT_PRESTIGE">EXPORT_PRESTIGE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.FAME_PER_TRADE">FAME_PER_TRADE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_DRUID">HERO_CLASS_DRUID</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_LIST">HERO_CLASS_LIST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_MAGE">HERO_CLASS_MAGE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_PRIEST">HERO_CLASS_PRIEST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_ROGUE">HERO_CLASS_ROGUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_SHAMAN">HERO_CLASS_SHAMAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HERO_CLASS_WARRIOR">HERO_CLASS_WARRIOR</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.HEROES">HEROES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.IMPORT_INFLUENCE">IMPORT_INFLUENCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.IMPORT_PRESTIGE">IMPORT_PRESTIGE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.IMPORTANCE_HIGH">IMPORTANCE_HIGH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.IMPORTANCE_LOW">IMPORTANCE_LOW</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.IMPORTANCE_MEDIUM">IMPORTANCE_MEDIUM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.IMPORTANCE_VITAL">IMPORTANCE_VITAL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.INITIAL_SEED">INITIAL_SEED</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_BACKPACK_NUM">ITEM_BACKPACK_NUM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_QUALITY_COLORS">ITEM_QUALITY_COLORS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_QUALITY_COMMON">ITEM_QUALITY_COMMON</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_QUALITY_EPIC">ITEM_QUALITY_EPIC</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_QUALITY_LEGENDARY">ITEM_QUALITY_LEGENDARY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_QUALITY_LIST">ITEM_QUALITY_LIST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_QUALITY_RARE">ITEM_QUALITY_RARE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_ANY_HAND">ITEM_SLOT_ANY_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_CHEST">ITEM_SLOT_CHEST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_FEET">ITEM_SLOT_FEET</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_HANDS">ITEM_SLOT_HANDS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_HEAD">ITEM_SLOT_HEAD</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_LEGS">ITEM_SLOT_LEGS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_MAIN_HAND">ITEM_SLOT_MAIN_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_NECK">ITEM_SLOT_NECK</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_NONE">ITEM_SLOT_NONE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_OFF_HAND">ITEM_SLOT_OFF_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_RING">ITEM_SLOT_RING</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_SHOULDER">ITEM_SLOT_SHOULDER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOT_WAIST">ITEM_SLOT_WAIST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOTS_LIST">ITEM_SLOTS_LIST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_SLOTS_NUM">ITEM_SLOTS_NUM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_TYPE_ARMOR">ITEM_TYPE_ARMOR</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_TYPE_OTHER">ITEM_TYPE_OTHER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_TYPE_WEAPON">ITEM_TYPE_WEAPON</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.ITEM_WEAPON_DAGGER_WICKED">ITEM_WEAPON_DAGGER_WICKED</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_CONSOLE_LINES">MAX_CONSOLE_LINES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_ESPIONAGE_SUCESS_RATE">MAX_ESPIONAGE_SUCESS_RATE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_ESPIONAGE_VALUE">MAX_ESPIONAGE_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_FAITH_VALUE">MAX_FAITH_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_INFLUENCE_VALUE">MAX_INFLUENCE_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_PRESTIGE_VALUE">MAX_PRESTIGE_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_RESEARCH_VALUE">MAX_RESEARCH_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_SETTLEMENT_ICONS">MAX_SETTLEMENT_ICONS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_SETTLEMENT_LEVEL">MAX_SETTLEMENT_LEVEL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MAX_SETTLEMENTS">MAX_SETTLEMENTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MERCENARIES">MERCENARIES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.METROPOLIS">METROPOLIS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MIN_ESPIONAGE_VALUE">MIN_ESPIONAGE_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MIN_FAITH_VALUE">MIN_FAITH_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MIN_FAME_VALUE">MIN_FAME_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MIN_INFLUENCE_VALUE">MIN_INFLUENCE_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MIN_PRESTIGE_VALUE">MIN_PRESTIGE_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MIN_RESEARCH_VALUE">MIN_RESEARCH_VALUE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MODE_MULTIPLAYER">MODE_MULTIPLAYER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.MODE_SINGLEPLAYER">MODE_SINGLEPLAYER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NAMES">NAMES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_ASSYRIAN">NATION_ASSYRIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_CARTHAGINIAN">NATION_CARTHAGINIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_CHINESE">NATION_CHINESE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_EGYPTIAN">NATION_EGYPTIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_FRANKS">NATION_FRANKS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_FRENCH">NATION_FRENCH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_GREEK">NATION_GREEK</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_INDIAN">NATION_INDIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_JAPANESE">NATION_JAPANESE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_KHMER">NATION_KHMER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_MALINESE">NATION_MALINESE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_MONGOLIAN">NATION_MONGOLIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_NIGERIAN">NATION_NIGERIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_PERSAN">NATION_PERSAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_PHOENICIAN">NATION_PHOENICIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_ROMAN">NATION_ROMAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_RUSSIAN">NATION_RUSSIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_SPANISH">NATION_SPANISH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_SUDANESE">NATION_SUDANESE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_SUMERIAN">NATION_SUMERIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_THRACIAN">NATION_THRACIAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATION_TIBETAN">NATION_TIBETAN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NATIONS">NATIONS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFICATION_MISSING_REQ">NOTIFICATION_MISSING_REQ</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFICATION_MISSING_RES">NOTIFICATION_MISSING_RES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFICATION_PAUSED">NOTIFICATION_PAUSED</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFICATION_SETTLEMENT_LOW_LEVEL">NOTIFICATION_SETTLEMENT_LOW_LEVEL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_ACHIEVEMENT">NOTIFY_ACHIEVEMENT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_ERROR">NOTIFY_ERROR</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_EVENT">NOTIFY_EVENT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_NORMAL">NOTIFY_NORMAL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_RELIGION">NOTIFY_RELIGION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_RESEARCH">NOTIFY_RESEARCH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.NOTIFY_WAR">NOTIFY_WAR</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.PERSONALITIES">PERSONALITIES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.PERSONALITY_BALANCED">PERSONALITY_BALANCED</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.PERSONALITY_DIPLOMAT">PERSONALITY_DIPLOMAT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.PERSONALITY_WARLORD">PERSONALITY_WARLORD</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.PLACE_RESOURCES_REQ">PLACE_RESOURCES_REQ</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.PLACE_TIME_TO_BUILD">PLACE_TIME_TO_BUILD</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.POPULATION_PER_LEVEL">POPULATION_PER_LEVEL</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RANDOM_UNCOMMON">RANDOM_UNCOMMON</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_BUDDHISM">RELIGION_BUDDHISM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_CHRISTIANITY">RELIGION_CHRISTIANITY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_CONFUCIANISM">RELIGION_CONFUCIANISM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_HINDUISM">RELIGION_HINDUISM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_ISLAM">RELIGION_ISLAM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_JUDAISM">RELIGION_JUDAISM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_NONE">RELIGION_NONE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGION_TAOISM">RELIGION_TAOISM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RELIGIONS">RELIGIONS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RESOURCE_CATEGORIES">RESOURCE_CATEGORIES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.RESOURCES">RESOURCES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SCOUT_COSTS">SCOUT_COSTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SCOUT_MISSION_INFO">SCOUT_MISSION_INFO</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SEASON_AUTUMN">SEASON_AUTUMN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SEASON_SPRING">SEASON_SPRING</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SEASON_SUMMER">SEASON_SUMMER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SEASON_WINTER">SEASON_WINTER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SEASONS">SEASONS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SECONDS_TO_DAY">SECONDS_TO_DAY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SETTLEMENT_NAMES">SETTLEMENT_NAMES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SETTLEMENTS">SETTLEMENTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SHIPS">SHIPS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SOLDIERS">SOLDIERS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPECIAL_PLACE">SPECIAL_PLACE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_COSTS">SPY_COSTS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_MISSION_INFLUENCE">SPY_MISSION_INFLUENCE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_MISSION_INSTIGATE">SPY_MISSION_INSTIGATE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_MISSION_NONE">SPY_MISSION_NONE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_MISSION_RELIGION">SPY_MISSION_RELIGION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_MISSION_STEAL_RESOURCES">SPY_MISSION_STEAL_RESOURCES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.SPY_MISSIONS">SPY_MISSIONS</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.STORAGE_KEY">STORAGE_KEY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.TECHNOLOGIES">TECHNOLOGIES</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.TRADES_ADDITION">TRADES_ADDITION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.TRADES_DISCOUNT">TRADES_DISCOUNT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.VERSION">VERSION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.VILLAGE">VILLAGE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE">WEAPON_TYPE_MELEE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_AXE_ONE_HAND">WEAPON_TYPE_MELEE_AXE_ONE_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_AXE_TWO_HAND">WEAPON_TYPE_MELEE_AXE_TWO_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_DAGGER">WEAPON_TYPE_MELEE_DAGGER</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_FIST">WEAPON_TYPE_MELEE_FIST</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_MACE_ONE_HAND">WEAPON_TYPE_MELEE_MACE_ONE_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_MACE_TWO_HAND">WEAPON_TYPE_MELEE_MACE_TWO_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_POLEARM">WEAPON_TYPE_MELEE_POLEARM</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_STAFF">WEAPON_TYPE_MELEE_STAFF</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_SWORD_ONE_HAND">WEAPON_TYPE_MELEE_SWORD_ONE_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_MELEE_SWORD_TWO_HAND">WEAPON_TYPE_MELEE_SWORD_TWO_HAND</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_RANGED">WEAPON_TYPE_RANGED</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_RANGED_BOW">WEAPON_TYPE_RANGED_BOW</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_RANGED_CROSSBOW">WEAPON_TYPE_RANGED_CROSSBOW</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_RANGED_GUN">WEAPON_TYPE_RANGED_GUN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WEAPON_TYPE_RANGED_THROWN">WEAPON_TYPE_RANGED_THROWN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WORLD_BEAUTIFY">WORLD_BEAUTIFY</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WORLD_EROSION">WORLD_EROSION</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WORLD_GRID">WORLD_GRID</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WORLD_HEX_SIZE">WORLD_HEX_SIZE</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WORLD_SIZE_HEIGHT">WORLD_SIZE_HEIGHT</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.WORLD_SIZE_WIDTH">WORLD_SIZE_WIDTH</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.YEARLY_INFLUENCE_GAIN">YEARLY_INFLUENCE_GAIN</a></li><li data-type='member' style='display: none;'><a href="civitas.html#.YEARLY_INFLUENCE_LOSS">YEARLY_INFLUENCE_LOSS</a></li></ul></li><li><a href="civitas.PANEL_ACADEMY.html">PANEL_ACADEMY</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_ACADEMY.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_ACADEMY.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_ACADEMY.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_ACADEMY.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_ARMY.html">PANEL_ARMY</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_ARMY.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_ARMY.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_ARMY.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_BARRACKS.html">PANEL_BARRACKS</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_BARRACKS.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_BARRACKS.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_BARRACKS.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_BARRACKS.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_BUILDING.html">PANEL_BUILDING</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_BUILDING.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_BUILDING.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_BUILDING.html#.on_refresh">on_refresh</a></li></ul></li><li><a href="civitas.PANEL_BUILDINGS.html">PANEL_BUILDINGS</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_BUILDINGS.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_BUILDINGS.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_BUILDINGS.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_CAMPAIGN.html">PANEL_CAMPAIGN</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_CAMPAIGN.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_CAMPAIGN.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_CAMPAIGN.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_CAMPAIGN.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_CHURCH.html">PANEL_CHURCH</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_CHURCH.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_CHURCH.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_CHURCH.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_CHURCH.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_COUNCIL.html">PANEL_COUNCIL</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_COUNCIL.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_COUNCIL.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_COUNCIL.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_COUNCIL.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_DEBUG.html">PANEL_DEBUG</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_DEBUG.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_DEBUG.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_DEBUG.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_EMBASSY.html">PANEL_EMBASSY</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_EMBASSY.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_EMBASSY.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_EMBASSY.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_EMBASSY.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_HELP.html">PANEL_HELP</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_HELP.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_HELP.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_HELP.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_NEW_ARMY.html">PANEL_NEW_ARMY</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_ARMY.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_ARMY.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_NEW_ARMY.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_NEW_CARAVAN.html">PANEL_NEW_CARAVAN</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_CARAVAN.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_CARAVAN.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_NEW_CARAVAN.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_NEW_SCOUT.html">PANEL_NEW_SCOUT</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_SCOUT.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_SCOUT.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_NEW_SCOUT.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_NEW_SCOUT.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_NEW_SPY.html">PANEL_NEW_SPY</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_SPY.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_NEW_SPY.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_NEW_SPY.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_NEW_SPY.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_PLACE.html">PANEL_PLACE</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_PLACE.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_PLACE.html#.params_data">params_data</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_PLACE.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_PLACE.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_PLACE.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_RANKS.html">PANEL_RANKS</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_RANKS.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_RANKS.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_RANKS.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_RANKS.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_SETTLEMENT.html">PANEL_SETTLEMENT</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_SETTLEMENT.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_SETTLEMENT.html#.params_data">params_data</a></li><li data-type='member' style='display: none;'><a href="civitas.PANEL_SETTLEMENT.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_SETTLEMENT.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_SETTLEMENT.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_SHIPYARD.html">PANEL_SHIPYARD</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_SHIPYARD.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_SHIPYARD.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_SHIPYARD.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_SHIPYARD.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_STORAGE.html">PANEL_STORAGE</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_STORAGE.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_STORAGE.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_STORAGE.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_STORAGE.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_TAVERN.html">PANEL_TAVERN</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_TAVERN.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_TAVERN.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_TAVERN.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_TAVERN.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_TRADES.html">PANEL_TRADES</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_TRADES.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_TRADES.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_TRADES.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_TRADES.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.PANEL_WORLD.html">PANEL_WORLD</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.PANEL_WORLD.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.PANEL_WORLD.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_WORLD.html#.on_refresh">on_refresh</a></li><li data-type='method' style='display: none;'><a href="civitas.PANEL_WORLD.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.utils.html">utils</a><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.utils.html#.calc_price">calc_price</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.calc_price_minus_discount">calc_price_minus_discount</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.calc_price_plus_discount">calc_price_plus_discount</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_damage_points">get_damage_points</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_health_points">get_health_points</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_mana_points">get_mana_points</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_now">get_now</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_random">get_random</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_random_by_importance">get_random_by_importance</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_random_unique">get_random_unique</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_resource_name">get_resource_name</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.get_up_number">get_up_number</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.nice_numbers">nice_numbers</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.resource_exists">resource_exists</a></li><li data-type='method' style='display: none;'><a href="civitas.utils.html#.time_since">time_since</a></li></ul></li><li><a href="civitas.WINDOW_BATTLE.html">WINDOW_BATTLE</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.WINDOW_BATTLE.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.WINDOW_BATTLE.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.WINDOW_BATTLE.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.WINDOW_ERROR.html">WINDOW_ERROR</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.WINDOW_ERROR.html#.id">id</a></li><li data-type='member' style='display: none;'><a href="civitas.WINDOW_ERROR.html#.template">template</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.WINDOW_ERROR.html#.on_hide">on_hide</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_ERROR.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.WINDOW_OPTIONS.html">WINDOW_OPTIONS</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.WINDOW_OPTIONS.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.WINDOW_OPTIONS.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_OPTIONS.html#.on_hide">on_hide</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_OPTIONS.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.WINDOW_SIGNIN.html">WINDOW_SIGNIN</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.WINDOW_SIGNIN.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.WINDOW_SIGNIN.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_SIGNIN.html#.on_hide">on_hide</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_SIGNIN.html#.on_show">on_show</a></li></ul></li><li><a href="civitas.WINDOW_SIGNUP.html">WINDOW_SIGNUP</a><ul class='members'><li data-type='member' style='display: none;'><a href="civitas.WINDOW_SIGNUP.html#.id">id</a></li></ul><ul class='methods'><li data-type='method' style='display: none;'><a href="civitas.WINDOW_SIGNUP.html#.on_create">on_create</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_SIGNUP.html#.on_hide">on_hide</a></li><li data-type='method' style='display: none;'><a href="civitas.WINDOW_SIGNUP.html#.on_show">on_show</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#capitalize">capitalize</a></li><li><a href="global.html#findIndexByHandle">findIndexByHandle</a></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">objects/core/settlement.js</h1>
    

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>/**
 * Main Game settlement object.
 * 
 * @param {Object} params
 * @license GPLv3
 * @class civitas.objects.settlement
 * @returns {civitas.objects.settlement}
 */
civitas.objects.settlement = function(params) {
	
	/**
	 * Settlement properties.
	 *
	 * @private
	 * @type {Object}
	 */
	this.properties = {
		id: null,
		type: null,
		name: null,
		storage: null,
		population: null,
		climate: null,
		level: null,
		icon: null,
		population: null,
		ruler: null,
		religion: null,
		player: null,
		nationality: null,
		color: null,
		waterside: false
	};

	/**
	 * Location of the settlement.
	 *
	 * @private
	 * @type {Object}
	 */
	this._location = {
		x: 0,
		y: 0
	};

	/**
	 * Diplomacy status with all the settlements in the world.
	 *
	 * @private
	 * @type {Object}
	 */
	this._status = {};

	/**
	 * Pointer to the game core.
	 * 
	 * @private
	 * @type {civitas.game}
	 */
	this._core = null;
	
	/**
	 * List of the buildings in this settlement.
	 * 
	 * @private
	 * @type {Array}
	 */
	this.buildings = [];

	/**
	 * Soldiers headquartered in this settlement.
	 * 
	 * @private
	 * @type {Number}
	 */
	this.army = {};

	/**
	 * Ships built in this settlement.
	 * 
	 * @private
	 * @type {Number}
	 */
	this.navy = {};

	/**
	 * Mercenary armies available for this settlement.
	 * 
	 * @private
	 * @type {Number}
	 */
	this._mercenary = [];
	
	/**
	 * The resources of this settlement.
	 * 
	 * @private
	 * @type {Object}
	 */
	this.resources = {};

	/**
	 * The settlement heroes.
	 *
	 * @private
	 * @type {Array}
	 */
	this._heroes = [];

	/**
	 * List of the imports and exports of this settlement.
	 * 
	 * @private
	 * @type {Object}
	 */
	this.trades = null;

	/**
	 * AI module for this settlement.
	 *
	 * @private
	 * @type {civitas.modules.ai}
	 */
	this._ai = null;

	/**
	 * Object constructor.
	 * 
	 * @private
	 * @constructor
	 * @returns {civitas.objects.settlement}
	 * @param {Object} params
	 */
	this.__init = function(params) {
		this._core = params.core;
		this.properties.id = params.properties.id;
		this.properties.name = (typeof params.properties.name !== 'undefined') ? params.properties.name: civitas.utils.get_random_unique(civitas.SETTLEMENT_NAMES);
		this.properties.player = (typeof params.properties.player !== 'undefined') ? params.properties.player : false;
		this.properties.level = (typeof params.properties.level !== 'undefined') ? params.properties.level : 1;
		this.properties.religion = (typeof params.properties.religion !== 'undefined') ? params.properties.religion : civitas.RELIGION_NONE;
		this.properties.nationality = (typeof params.properties.nationality !== 'undefined') ? params.properties.nationality : this.core().get_random_nationality();
		this.properties.type = (typeof params.properties.type !== 'undefined') ? params.properties.type : civitas.CITY;
		this.properties.ruler = (typeof params.properties.ruler !== 'undefined') ? params.properties.ruler : {
				title: (this.properties.type === civitas.CAMP) ? 'Warlord' : 'Mayor',
				avatar: civitas.utils.get_random(1, civitas.AVATARS),
				personality: (this.properties.type === civitas.CAMP) ? civitas.PERSONALITY_WARLORD : this.core().get_random_personality(),
				name: civitas.utils.get_random_unique(civitas.NAMES)
			};
		this.properties.icon = (typeof params.properties.icon !== 'undefined') ? params.properties.icon : 1;
		this.properties.waterside = (typeof params.properties.waterside !== 'undefined') ? params.properties.waterside : false;
		this.army = this.load_army(params.army);
		this._mercenary = (typeof params.mercenary !== 'undefined') ? params.mercenary : [];
		this._status = (typeof params.status !== 'undefined') ? params.status : {};
		this._heroes = (typeof params.heroes !== 'undefined') ? params.heroes : [];
		this.resources = (typeof params.resources !== 'undefined') ? params.resources : {};
		this._fill_resources();
		this._location = params.location;
		this.properties.color = (typeof params.properties.color !== 'undefined') ? params.properties.color : this.core().ui().get_random_color();
		this.core().world().add_settlement(this);
		if (this.waterside() === true) {
			this.navy = this.load_navy(params.navy);
		}
		this.trades = (typeof params.trades !== 'undefined') ? params.trades : {
				'imports': {},
				'exports': {}
			};
		if (!this.is_player()) {
			this.resources.fame = this.core().level_to_fame(this.level());
			this._ai = new civitas.modules.ai({
				core: this,
				type: this.properties.ruler.personality
			});
		}
		if (!this.is_player()) {
			const terrain = this.core().world().get_hex_terrain({
				x: this._location.x,
				y: this._location.y
			});
			const climate = this.core().world().get_climate_from_terrain(terrain);
			this.properties.climate = civitas['CLIMATE_' + climate.name.toUpperCase()];
			if (this.is_urban()) {
				this.setup_initial_buildings(this.core().get_buildings_for_settlement(this), true);
			}
		} else {
			this.properties.climate = params.properties.climate;
		}
		this.properties.population = (typeof params.properties.population !== 'undefined') ? params.properties.population : this.level() * civitas.POPULATION_PER_LEVEL;
		return this;
	};

	/**
	 * Get a reference to the AI module.
	 *
	 * @public
	 * @returns {civitas.modules.ai}
	 */
	this.ai = function() {
		return this._ai;
	};

	/**
	 * Export settlement data.
	 *
	 * @returns {Object}
	 * @public
	 */
	this.export = function() {
		const data = {
			properties: this.get_properties(),
			trades: this.get_trades(),
			resources: this.get_resources(),
			army: this.get_army(),
			navy: this.get_navy(),
			buildings: this.export_buildings(),
			mercenary: this.mercenary(),
			heroes: this.heroes(),
			location: this.location()
		};
		if (this.is_player()) {
			data.status = this.status();
		}
		return data;
	};

	/**
	 * Get the settlement properties.
	 *
	 * @public
	 * @returns {Object}
	 */
	this.get_properties = function() {
		return this.properties;
	};

	/**
	 * Get/set if the settlement is waterside (can build ships).
	 * 
	 * @public
	 * @returns {Boolean}
	 */
	this.waterside = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.waterside = value;
		}
		return this.properties.waterside;
	};

	/**
	 * Get/set the name of this settlement.
	 * 
	 * @public
	 * @param {String} value
	 * @returns {String}
	 */
	this.name = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.name = value;
		}
		return this.properties.name;
	};

	/**
	 * Return a pointer to the game core.
	 * 
	 * @public
	 * @returns {civitas.game}
	 */
	this.core = function() {
		return this._core;
	};

	/**
	 * Raise the level of this settlement.
	 * 
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.level_up = function() {
		const level = this.level();
		this.fame(this.core().level_to_fame(level));
		this.properties.level++;
		this.properties.population = this.level() * civitas.POPULATION_PER_LEVEL;
		this.core().ui().log('The city of ' + this.name() + ' is now level ' + this.level() + '.');
		return this;
	};

	/**
	 * Rename this settlement.
	 * 
	 * @public
	 * @param {String} value
	 * @returns {String}
	 */
	this.rename = function(value) {
		return this.name(value);
	};

	/**
	 * Get the rank of this settlement
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.get_rank = function() {
		const half_level = Math.round(this.level() / 2);
		const rank = {
			fame: this.fame(),
			prestige: this.prestige(),
			espionage: this.espionage(),
			score: Math.floor((
				(this.fame() / half_level) + (this.prestige() / half_level) + (this.espionage() / half_level)
			) / half_level)
		};
		return rank;
	};
	
	/**
	 * Get/set the ruler object of this settlement.
	 * 
	 * @public
	 * @param {Object} value
	 * @returns {Object}
	 */
	this.ruler = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.ruler = value;
		}
		return this.properties.ruler;
	};

	/**
	 * Get/set the level of this settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.level = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.level = value;
		}
		return this.properties.level;
	};

	/**
	 * Get/set the personality of the ruler of this settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Object}
	 */
	this.personality = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.ruler.personality = value;
		}
		return {
			id: this.properties.ruler.personality,
			name: civitas.PERSONALITIES[this.properties.ruler.personality].capitalize()
		};
	};

	/**
	 * Get/set the climate of the area of this settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Object}
	 */
	this.climate = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.climate = value;
		}
		return {
			id: this.properties.climate,
			name: civitas.CLIMATES[this.properties.climate].capitalize()
		};
	};
	
	/**
	 * Get/set the nationality of this settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Object}
	 */
	this.nationality = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.nationality = value;
		}
		return {
			id: this.properties.nationality,
			name: civitas.NATIONS[this.properties.nationality].capitalize()
		};
	};

	/**
	 * Get/set the icon of this settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.icon = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.icon = value;
		}
		return this.properties.icon;
	};

	/**
	 * Get/set the id of this settlement.
	 *
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.id = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.id = id;
		}
		return this.properties.id;
	};

	/**
	 * Check if this settlement is a player settlement.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.is_player = function() {
		return this.properties.player;
	};

	/**
	 * Return the type of this settlement.
	 *
	 * @public
	 * @returns {Number}
	 */
	this.get_type = function() {
		return this.properties.type;
	};

	/**
	 * Return the population of this settlement.
	 *
	 * @public
	 * @returns {Number}
	 */
	this.population = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.population = value;
		}
		return this.properties.population;
	};

	/**
	 * Check if this settlement is a city.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.is_city = function() {
		return this.properties.type === civitas.CITY;
	};

	/**
	 * Check if this settlement is a metropolis.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.is_metropolis = function() {
		return this.properties.type === civitas.METROPOLIS;
	};

	/**
	 * Check if this settlement is a camp.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.is_camp = function() {
		return this.properties.type === civitas.CAMP;
	};

	/**
	 * Check if this settlement is a village.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.is_village = function() {
		return this.properties.type === civitas.VILLAGE;
	};

	/**
	 * Refresh the heroes in the Tavern.
	 *
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.refresh_heroes = function() {
		if (this.is_building_built('tavern')) {
			// TODO
		}
	};

	/**
	 * Check if the player settlement's nationality and the one passed as parameter nationality are the same.
	 *
	 * @param {String|civitas.objects.settlement|Number} settlement
	 * @returns {Boolean}
	 * @public
	 */
	this.has_same_nationality = function(settlement) {
		if (typeof settlement === 'object' &amp;&amp; this.nationality().id === settlement.nationality().id) {
			return true;
		} else if (typeof settlement === 'number' || typeof settlement === 'string') {
			const _settlement = this.core().get_settlement(settlement);
			if (typeof _settlement !== 'undefined') {
				if (this.nationality().id === _settlement.nationality().id) {
					return true;
				}
			}
		}
		return false;
	};

	/**
	 * Get/set the heroes of the settlement.
	 *
	 * @public
	 * @returns {Object}
	 */
	this.heroes = function(value) {
		if (typeof value !== 'undefined') {
			this._heroes = value;
		}
		return this._heroes;
	};

	/**
	 * Get/set the location of the settlement.
	 *
	 * @public
	 * @param {Object} value
	 * @returns {Object}
	 */
	this.location = function(value) {
		if (typeof value !== 'undefined') {
			this._location = value;
		}
		return this._location;
	};

	/**
	 * Change this settlement's type to city.
	 *
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.to_city = function() {
		this.properties.type = civitas.CITY;
	};

	/**
	 * Change this settlement's type to village.
	 *
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.to_village = function() {
		this.properties.type = civitas.VILLAGE;
	};

	/**
	 * Change this settlement's type to camp.
	 *
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.to_camp = function() {
		this.properties.type = civitas.CAMP;
	};

	/**
	 * Change this settlement's type to metropolis.
	 *
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.to_metropolis = function() {
		this.properties.type = civitas.METROPOLIS;
	};

	/**
	 * Check if the settlement has soldiers in its army.
	 *
	 * @public
	 * @param {Object} data
	 * @returns {Boolean}
	 */
	this.has_soldiers = function(data) {
		const army = this.get_army();
		for (let item in army) {
			if (army[item] - data[item] &lt; 0) {
				return false;
			}
		}
		return true;
	};

	/**
	 * Adjust costs for the campaign.
	 *
	 * @public
	 * @param {Object} cost
	 * @param {Number} duration
	 * @param {Object} resources
	 * @returns {Object}
	 */
	this.adjust_campaign_cost = function(cost, duration, resources) {
		let mission_costs = cost;
		for (let item in mission_costs) {
			if (item === 'coins') {
				mission_costs[item] = Math.ceil(cost[item] * duration);
			} else if (item === 'provisions') {
				mission_costs[item] = Math.ceil((cost[item] * duration) / 4);
			}
		}
		if (typeof resources !== 'undefined') {
			let merged_costs = $.extend({}, resources);
			for (let item in mission_costs) {
				if (merged_costs[item]) {
					merged_costs[item] += mission_costs[item];
				} else {
					merged_costs[item] = mission_costs[item];
				}
			}
			return merged_costs;
		}
		return mission_costs;
	};

	/**
	 * Remove soldiers from the settlement's army (to create another army).
	 *
	 * @public
	 * @param {Object} data
	 * @returns {Boolean}
	 */
	this.split_army = function(data) {
		let army = this.get_army();
		if (this.has_soldiers(data)) {
			for (let item in army) {
				if (army[item] - data[item] >= 0) {
					army[item] = army[item] - data[item];
				} else {
					army[item] = 0;
				}
			}
			return true;
		}
		return false;
	};

	/**
	 * Get the color of the settlement.
	 *
	 * @public
	 * @returns {String}
	 */
	this.color = function() {
		return this.properties.color;
	};

	/**
	 * Check if the settlement has ships in its navy.
	 *
	 * @public
	 * @param {Object} data
	 * @returns {Boolean}
	 */
	this.has_ships = function(data) {
		let navy = this.get_navy();
		for (let item in navy) {
			if (navy[item] - data[item] &lt; 0) {
				return false;
			}
		}
		return true;
	};

	/**
	 * Remove ships from the settlement's navy (to create another navy).
	 *
	 * @public
	 * @param {Object} data
	 * @returns {Boolean}
	 */
	this.split_navy = function(data) {
		let navy = this.get_navy();
		if (this.has_ships(data)) {
			for (let item in navy) {
				if (navy[item] - data[item] >= 0) {
					navy[item] = navy[item] - data[item];
				} else {
					navy[item] = 0;
				}
			}
			return true;
		}
		return false;
	};

	/**
	 * Return the number of the ships in this settlement's navy.
	 * 
	 * @public
	 * @param {Object} navy
	 * @returns {Object}
	 */
	this.num_ships = function(navy) {
		let total = 0;
		if (typeof navy === 'undefined') {
			navy = this.navy;
		}
		for (let item in navy) {
			if (typeof navy[item] !== 'undefined') {
				total = total + navy[item];
			}
		}
		return total;
	};

	/**
	 * Return the number of the soldiers in this settlement's army.
	 * 
	 * @public
	 * @param {Object} army
	 * @returns {Object}
	 */
	this.num_soldiers = function(army) {
		let total = 0;
		if (typeof army === 'undefined') {
			army = this.army;
		}
		for (let item in army) {
			if (typeof army[item] !== 'undefined') {
				total += army[item];
			}
		}
		return total;
	};

	/**
	 * Merge two armies.
	 *
	 * @public
	 * @param {Object} army
	 */
	this.merge_army = function(army) {
		const _army = this.get_army();
		let merged_army = $.extend({}, _army);
		for (let item in army) {
			if (merged_army[item]) {
				merged_army[item] += army[item];
			} else {
				merged_army[item] = army[item];
			}
		}
		this.army = merged_army;
	};

	/**
	 * Merge two navies.
	 *
	 * @public
	 * @param {Object} navy
	 */
	this.merge_navy = function(navy) {
		const _navy = this.get_navy();
		let merged_navy = $.extend({}, _navy);
		for (let item in navy) {
			if (merged_navy[item]) {
				merged_navy[item] += navy[item];
			} else {
				merged_navy[item] = navy[item];
			}
		}
		this.navy = merged_navy;
	};

	/**
	 * Method for the setup of the settlement's army.
	 *
	 * @public
	 * @param {Object} params
	 * @returns {Object}
	 */
	this.load_army = function(params) {
		let army = {};
		for (let item in civitas.SOLDIERS) {
			if (typeof params !== 'undefined' &amp;&amp; typeof params[item] !== 'undefined') {
				army[item] = params[item];
			} else {
				army[item] = 0;
			}
		}
		return army;
	};

	/**
	 * Internal method for the initial setup of the settlement's navy.
	 *
	 * @private
	 * @param {Object} params
	 * @returns {Object}
	 */
	this.load_navy = function(params) {
		let navy = {};
		for (let item in civitas.SHIPS) {
			if (typeof params !== 'undefined' &amp;&amp; typeof params[item] !== 'undefined') {
				navy[item] = params[item];
			} else {
				navy[item] = 0;
			}
		}
		return navy;
	};

	/**
	 * Get the list of settlement mercenary armies.
	 *
	 * @public
	 * @param {Array} value
	 * @returns {Array}
	 */
	this.mercenary = function(value) {
		if (typeof value !== 'undefined') {
			this._mercenary = value;
		}
		return this._mercenary;
	};

	/**
	 * Check if this settlement can build ships.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.can_build_ships = function() {
		return this.is_building_built('shipyard');
	};

	/**
	 * Check if this settlement can recruit soldiers.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.can_recruit_soldiers = function() {
		return this.is_building_built('barracks');
	};

	/**
	 * Recruit a soldier for the settlement's army.
	 * 
	 * @public
	 * @param {String} name
	 * @returns {Boolean}
	 */
	this.recruit_mercenary_army = function(name) {
		for (let i = 0; i &lt; civitas.MERCENARIES.length; i++) {
			if (name === civitas.MERCENARIES[i].handle) {
				const price = civitas.MERCENARIES[i].cost;
				if (this.dec_coins(price) === false) {
					return false;
				}
				const army = {
					id: i,
					handle: name,
					army: {}
				};
				for (let item in civitas.SOLDIERS) {
					if (typeof civitas.MERCENARIES[i].army[item] !== 'undefined') {
						army.army[item] = civitas.MERCENARIES[i].army[item];
					} else {
						army.army[item] = 0;
					}
				}
				this._mercenary.push(army);
				if (this.is_player()) {
					this.core().ui().notify('The mercenaries of the ' + civitas.MERCENARIES[i].name + ' are now available for skirmish missions for the duration of one year.', 'Mercenaries recruited.');
				}
				this.core().ui().log('game', 'The city of ' + this.name() + ' hired the mercenaries of ' + civitas.MERCENARIES[i].name + '.');
				this.core().save_and_refresh();
				return true;
			}
		}
		return false;
	};

	/**
	 * Construct a ship for the settlement's navy.
	 * 
	 * @public
	 * @param {String} ship_name
	 * @returns {Boolean}
	 */
	this.recruit_ship = function(ship_name) {
		if (typeof this.navy[ship_name] !== 'undefined' &amp;&amp; this.navy[ship_name] !== null ) {
			this.navy[ship_name] = this.navy[ship_name] + 1;
		} else {
			this.navy[ship_name] = 1;
		}
		if (this.is_player()) {
			this.core().save_and_refresh();
		}
		return true;
	};

	/**
	 * Recruit a soldier for the settlement's army.
	 * 
	 * @public
	 * @param {String} soldier_name
	 * @returns {Boolean}
	 */
	this.recruit_soldier = function(soldier_name) {
		if (typeof this.army[soldier_name] !== 'undefined' &amp;&amp; this.army[soldier_name] !== null ) {
			this.army[soldier_name] = this.army[soldier_name] + 1;
		} else {
			this.army[soldier_name] = 1;
		}
		if (this.is_player()) {
			this.core().save_and_refresh();
		}
		return true;
	};

	/**
	 * Disband a ship from the settlement's navy.
	 * 
	 * @public
	 * @param {String} ship_name
	 * @returns {Boolean}
	 */
	this.disband_ship = function(ship_name) {
		if (typeof this.navy[ship_name] === 'undefined') {
			return false;
		} else {
			if (this.navy[ship_name] - 1 >= 0) {
				this.navy[ship_name] = this.navy[ship_name] - 1;
			} else {
				this.navy[ship_name] = 0;
			}
		}
		return true;
	};

	/**
	 * Disband a soldier from the settlement's army.
	 * 
	 * @public
	 * @param {String} soldier_name
	 * @returns {Boolean}
	 */
	this.disband_soldier = function(soldier_name) {
		if (typeof this.army[soldier_name] === 'undefined') {
			return false;
		} else {
			if (this.army[soldier_name] - 1 >= 0) {
				this.army[soldier_name] = this.army[soldier_name] - 1;
			} else {
				this.army[soldier_name] = 0;
			}
		}
		return true;
	};

	/**
	 * Set the navy of the settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {civitas.objects.settlement}
	 */
	this.set_navy = function(value) {
		this.navy = value;
		return this;
	};

	/**
	 * Set the soldiers of the settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {civitas.objects.settlement}
	 */
	this.set_army = function(value) {
		this.army = value;
		return this;
	};

	/**
	 * Release all the mercenary armies.
	 * 
	 * @public
	 * @returns {civitas.objects.settlement}
	 */
	this.release_mercenaries = function() {
		this._mercenary = [];
		return this;
	};

	/**
	 * Get the total number of soldiers available in this settlement.
	 * 
	 * @public
	 * @returns {Number}
	 */
	this.get_army = function() {
		return this.army;
	};
		
	/**
	 * Get the total number of ships available in this settlement.
	 * 
	 * @public
	 * @returns {Number}
	 */
	this.get_navy = function() {
		return this.navy;
	};

	/**
	 * Check if this mercenary army has already been recruited.
	 * 
	 * @public
	 * @param {String} handle
	 * @returns {Boolean}
	 */
	this.is_mercenary_recruited = function(handle) {
		for (let i = 0; i &lt; this._mercenary.length; i++) {
			if (typeof this._mercenary[i] !== 'undefined') {
				if (this._mercenary[i].handle === handle) {
					return true;
				}
			}
		}
		return false;
	};

	/**
	 * Release a recruited mercenary army.
	 *
	 * @public
	 * @param {Number} id
	 * @returns {Boolean}
	 */
	this.release_mercenary = function(id) {
		if (typeof this._mercenary[id] !== 'undefined') {
			const mercenary_army_data = civitas.MERCENARIES[id];
			this._mercenary.splice(id, 1);
			if (this.is_player()) {
				this.core().ui().notify(mercenary_army_data.name + ' has been released from its duties.');
			}
			return true;
		} else {
			return false;
		}
	};

	/**
	 * Get the list of settlement buildings, for export reasons.
	 *
	 * @public
	 * @returns {Array}
	 */
	this.export_buildings = function() {
		const buildings_list = [];
		for (let i = 0; i &lt; this.buildings.length; i++) {
			if (typeof this.buildings[i] !== 'undefined') {
				buildings_list.push({
					handle: this.buildings[i].get_handle(),
					level: this.buildings[i].get_level(),
					stopped: this.buildings[i].is_stopped()
				});
			}
		}
		return buildings_list;
	};

	/**
	 * Return a pointer to the specified building in this settlement by the specified
	 * handle.
	 * 
	 * @public
	 * @param {String} handle
	 * @returns {civitas.objects.building|Boolean}
	 */
	this.get_building = function(handle) {
		const buildings = this.get_buildings();
		if (typeof handle === 'string') {
			for (let i = 0; i &lt; buildings.length; i++) {
				if (typeof buildings[i] !== 'undefined') {
					if (buildings[i].get_type() === handle) {
						return buildings[i];
					}
				}
			}
		}
		return false;
	};

	/**
	 * Internal method for creating a building.
	 *
	 * @private
	 * @param {String|Object} building
	 * @param {Boolean} hidden
	 * returns {Boolean}
	 */
	this._build = function(building, hidden) {
		hidden = (typeof hidden !== 'undefined') &amp;&amp; hidden === true ? true : false;
		const handle = typeof building.handle !== 'undefined' ? building.handle : building;
		const level = typeof building.level !== 'undefined' ? building.level : 1;
		const stopped = typeof building.stopped !== 'undefined' ? building.stopped : false;
		const building_data = this.get_building_data(handle);
		if (building_data) {
			if (level > 1) {
				building_data.level = level;
			}
			let new_building = new civitas.objects.building({
				settlement: this,
				type: handle,
				data: building_data,
				hidden: hidden,
				stopped: stopped
			});
			this.buildings.push(new_building);
			return true;
		}
		return false;
	};

	/**
	 * Internal function for building the specified buildings, bypassing
	 * the requirements.
	 * 
	 * @public
	 * @param {String|Object} building_type
	 * @param {Boolean} hidden
	 * @returns {Boolean}
	 */
	this.setup_initial_buildings = function(building_type, hidden) {
		if (typeof building_type === 'object') {
			for (let i = 0; i &lt; building_type.length; i++) {
				this._build(building_type[i], hidden);
			}
			return true;
		} else {
			this._build(building_type, hidden);
			return true;
		}
		return false;
	};

	/**
	 * Get the building data.
	 *
	 * @public
	 * @param {String} handle
	 * @returns {Object|Boolean}
	 */
	this.get_building_data = function(handle) {
		const id = civitas.BUILDINGS.findIndexByHandle(handle);
		if (id !== false) {
			return civitas.BUILDINGS[id];
		}
		return false;
	};

	/**
	 * Build the specified building.
	 * 
	 * @public
	 * @param {String} building_type
	 * @returns {civitas.objects.building|Boolean}
	 */
	this.build = function(building_type) {
		const building_data = this.get_building_data(building_type);
		if (building_data) {
			if ((typeof building_data.requires.settlement_level !== 'undefined') &amp;&amp; (this.properties.level &lt; building_data.requires.settlement_level)) {
				if (this.is_player()) {
					this.core().ui().error('Your city level is too low to construct this building.');
				}
				return false;
			}
			if ((typeof building_data.requires.climate !== 'undefined') &amp;&amp; ($.inArray(this.climate().id, building_data.requires.climate) === -1)) {
				if (this.is_player()) {
					this.core().ui().error('Your city lacks the required fertility and climate to construct this building.');
				}
				return false;
			}
			if ((typeof building_data.requires.research !== 'undefined') &amp;&amp; (!this.core().has_research(building_data.requires.research))) {
				if (this.is_player()) {
					this.core().ui().error('Your city is missing the `' + this.core().get_research_config_data(building_data.requires.research).name + '` research needed to construct this building.');
				}
				return false;
			}
			if (typeof building_data.requires.buildings !== 'undefined') {
				const required = building_data.requires.buildings;
				for (let item in required) {
					if (!this.is_building_built(item, required[item])) {
						const _z = this.core().get_building_config_data(item);
						if (_z) {
							if (this.is_player()) {
								this.core().ui().error('You don`t have the required level ' + required[item] + ' ' + _z.name + '.');
							}
						}
						return false;
					}
				}
			}
			if (!this.has_resources(building_data.cost)) {
				if (this.is_player()) {
					this.core().ui().error('You don`t have enough resources to construct this building.');
				}
				return false;
			}
			if (!this.remove_resources(building_data.cost)) {
				return galse;
			}
			const _building = new civitas.objects.building({
				settlement: this,
				type: building_type,
				data: building_data
			});
			this.buildings.push(_building);
			this.raise_prestige();
			if (this.is_player()) {
				this.core().save_and_refresh();
				this.core().ui().citymap_scrollto_building(_building);
				this.core().ui().notify('A new ' + _building.get_name() + ' was just constructed in your city.');
				$('.tips').tipsy({
					gravity: $.fn.tipsy.autoNS,
					html: true
				});
			}
			return _building;
		}
		return false;
	};

	/**
	 * Check if the specified building is already built.
	 * 
	 * @public
	 * @param {String} handle
	 * @param {Number} level
	 * @returns {Boolean}
	 */
	this.is_building_built = function(handle, level) {
		if (typeof level === 'undefined') {
			level = 1;
		}
		const buildings = this.get_buildings();
		for (let i = 0; i &lt; buildings.length; i++) {
			if (typeof buildings[i] !== 'undefined') {
				if (buildings[i].type === handle &amp;&amp; buildings[i].level >= level) {
					return true;
				}
			}
		}
		return false;
	};

	/**
	 * Get the list of all the buildings in this settlement.
	 * 
	 * @public
	 * @returns {Array}
	 */
	this.get_buildings = function() {
		return this.buildings;
	};

	/**
	 * Perform diplomacy missions.
	 *
	 * @public
	 * @param {Number|civitas.objects.settlement} settlement
	 * @param {Number} mode
	 * @returns {Boolean}
	 */
	this.diplomacy = function(settlement, mode) {
		if (typeof settlement === 'object') {
			settlement = settlement.id();
		}
		if (typeof settlement === 'number') {
			this._status[settlement].status = mode;
			if (mode === civitas.DIPLOMACY_WAR) {
				this.core().do_achievement('declarewar');
				this.reset_influence(settlement);
			} else if (mode === civitas.DIPLOMACY_ALLIANCE) {
				this.core().do_achievement('gotyourback');
				this.set_influence(settlement, civitas.MAX_INFLUENCE_VALUE);
			} else if (mode === civitas.DIPLOMACY_PACT) {
				this.core().do_achievement('pactish');
				this.set_influence(settlement, Math.ceil(civitas.MAX_INFLUENCE_VALUE / 2));
			} else if (mode === civitas.DIPLOMACY_CEASE_FIRE) {
				this.set_influence(settlement, Math.ceil(civitas.MAX_INFLUENCE_VALUE / 4));
			} else if (mode === civitas.DIPLOMACY_VASSAL) {
				this.core().do_achievement('youaremine');
				this.set_influence(settlement, civitas.MAX_INFLUENCE_VALUE);
			}
			this.core().save_and_refresh();
			return true;
		}
		return false;
	};

	/**
	 * Get/set the diplomatic status with another settlement.
	 *
	 * @public
	 * @param {Number} settlement
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.status = function(settlement, value) {
		if (typeof value !== 'undefined') {
			this._status[settlement] = value;
		}
		if (typeof settlement !== 'undefined') {
			return this._status[settlement];
		} else {
			return this._status;
		}
	};

	/**
	 * Check if this settlement can recruit heroes.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.can_recruit_heroes = function() {
		return this.is_building_built('tavern');
	};

	/**
	 * Check if this settlement can conduct diplomatic missions.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.can_diplomacy = function() {
		return this.is_building_built('embassy');
	};

	/**
	 * Returns the influenceof this settlement with a specific settlement.
	 * 
	 * @public
	 * @param {String} settlement
	 * @returns {Number}
	 */
	this.get_influence_with_settlement = function(settlement) {
		if (typeof settlement === 'number') {
			return this._status[settlement].influence;
		} else if (typeof settlement === 'object') {
			return this._status[settlement.id()].influence;
		} else if (typeof settlement === 'string') {
			return this._status[this.core().get_settlement(settlement)].influence;
		}
	};

	/**
	 * Decrease the influence of this settlement.
	 * 
	 * @public
	 * @param {String} settlement
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.lower_influence = function(settlement, value) {
		if (typeof value === 'undefined') {
			value = 1;
		}
		return this.set_influence(settlement, this.get_influence_with_settlement(settlement) - value);
	};

	/**
	 * Set the influence with the specified settlement to this value.
	 *
	 * @public
	 * @param {civitas.objects.settlement} settlement
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.set_influence = function(settlement, value) {
		if (typeof settlement === 'object') {
			settlement = settlement.id();
		} else if (typeof settlement === 'string') {
			settlement = this.core().get_settlement(settlement);
		}
		if (value &lt; civitas.MIN_INFLUENCE_VALUE || this._status[settlement].influence &lt; civitas.MIN_INFLUENCE_VALUE) {
			this._status[settlement].influence = civitas.MIN_INFLUENCE_VALUE;
		} else {
			this._status[settlement].influence = value;
		}
		if (this._status[settlement].influence >= civitas.MAX_INFLUENCE_VALUE) {
			this._status[settlement].influence = civitas.MAX_INFLUENCE_VALUE;
		}
		return this.get_influence_with_settlement(settlement);
	};

	/**
	 * Increase the influence of this settlement.
	 * 
	 * @public
	 * @param {String} settlement
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.raise_influence = function(settlement, value) {
		if (typeof value === 'undefined') {
			value = 1;
		}
		return this.set_influence(settlement, this.get_influence_with_settlement(settlement) + value);
	};

	/**
	 * Reset the influence of this settlement.
	 * 
	 * @param {Number} s_id
	 * @returns {civitas.objects.settlement}
	 * @public
	 */
	this.reset_influence = function(s_id) {
		this.set_influence(s_id, civitas.MIN_INFLUENCE_VALUE);
		return this;
	};
		
	/**
	 * Return the diplomacy status of this settlement.
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.get_diplomacy_status = function(settlement) {
		return {
			id: this._status[settlement].status,
			name: civitas.DIPLOMACIES[this._status[settlement].status].capitalize()
		};
	};
	/**
	 * Raise the espionage of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.raise_espionage = function(value) {
		if (typeof value === 'undefined') {
			value = 1;
		}
		return this.espionage(this.espionage() + value);
	};

	/**
	 * Lower the espionage of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.lower_espionage = function(value) {
		if (typeof value === 'undefined') {
			value = 1;
		}
		return this.espionage(this.espionage() - value);
	};

	/**
	 * Reset the espionage of this settlement.
	 * 
	 * @returns {Number}
	 * @public
	 */
	this.reset_espionage = function() {
		return this.espionage(civitas.MIN_ESPIONAGE_VALUE);
	};

	/**
	 * Get/set the espionage of this settlement.
	 * 
	 * @public
	 * @returns {Number}
	 * @param {Number} value
	 */
	this.espionage = function(value) {
		if (typeof value !== 'undefined') {
			if (value &lt; civitas.MIN_ESPIONAGE_VALUE || this.resources.espionage &lt; civitas.MIN_ESPIONAGE_VALUE) {
				this.resources.espionage = civitas.MIN_ESPIONAGE_VALUE;
			} else {
				this.resources.espionage = value;
			}
			if (this.resources.espionage >= civitas.MAX_ESPIONAGE_VALUE) {
				this.resources.espionage = civitas.MAX_ESPIONAGE_VALUE;
			}
		}
		return this.resources.espionage;
	};
	/**
	 * Increase this settlement's fame by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.raise_fame = function(amount) {
		if (typeof amount === 'undefined') {
			amount = 1;
		}
		return this.fame(this.fame() + amount);
	};

	/**
	 * Decrease this settlement's fame by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.lower_fame = function(amount) {
		if (typeof amount === 'undefined') {
			amount = 1;
		}
		return this.fame(this.fame() - amount);
	};

	/**
	 * Get/set this settlement's fame.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.fame = function(value) {
		if (typeof value !== 'undefined') {
			if (value &lt; civitas.MIN_FAME_VALUE || this.resources.fame &lt; civitas.MIN_FAME_VALUE) {
				this.resources.fame = civitas.MIN_FAME_VALUE;
			} else {
				this.resources.fame = value;
			}
			return value;
		} else {
			return this.resources.fame;
		}
	};

	/**
	 * Reset the fame of this settlement.
	 * 
	 * @returns {Number}
	 * @public
	 */
	this.reset_fame = function() {
		return this.fame(civitas.MIN_FAME_VALUE);
	};

	/**
	 * Raise the prestige of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.raise_prestige = function(amount) {
		if (typeof amount === 'undefined') {
			amount = 1;
		}
		return this.prestige(this.prestige() + amount);
	};

	/**
	 * Lower the prestige of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.lower_prestige = function(amount) {
		if (typeof amount === 'undefined') {
			amount = 1;
		}
		return this.prestige(this.prestige() - amount);
	};

	/**
	 * Reset the prestige of this settlement.
	 * 
	 * @returns {Number}
	 * @public
	 */
	this.reset_prestige = function() {
		return this.prestige(civitas.MIN_PRESTIGE_VALUE);
	};

	/**
	 * Get/set the prestige of this settlement.
	 * 
	 * @public
	 * @returns {Number}
	 * @param {Number} value
	 */
	this.prestige = function(value) {
		if (typeof value !== 'undefined') {
			if (value &lt; civitas.MIN_PRESTIGE_VALUE || this.resources.prestige &lt; civitas.MIN_PRESTIGE_VALUE) {
				this.resources.prestige = civitas.MIN_PRESTIGE_VALUE;
			} else {
				this.resources.prestige = value;
			}
			if (this.resources.prestige >= civitas.MAX_PRESTIGE_VALUE) {
				this.resources.prestige = civitas.MAX_PRESTIGE_VALUE;
			}
		}
		return this.resources.prestige;
	};
	/**
	 * Change religion of your settlement.
	 *
	 * @public
	 * @param {Number|String} id
	 * @returns {Boolean}
	 */
	this.change_religion = function(id) {
		if (this.faith() !== civitas.MAX_FAITH_VALUE &amp;&amp; id !== 0) {
			if (this.is_player()) {
				this.core().ui().error('You don`t have enough faith to switch religions.');
			}
			return false;
		}
		if ((typeof id === 'number' &amp;&amp; this.religion().id === id) || (typeof id === 'string' &amp;&amp; this.religion().name === id)) {
			if (this.is_player()) {
				this.core().ui().error('You cannot switch religion to your already existing one.');
			}
			return false;
		}
		if (!this.religion(id)) {
			if (this.is_player()) {
				this.core().ui().error('Unable to switch religion to the specified one.');
			}
			return false;
		}
		this.reset_faith();
		this.refresh_heroes();
		if (this.is_player()) {
			this.core().ui().notify('Your settlement`s new religion is &lt;strong>' + this.religion().name + '&lt;/strong>', 'Religion Adopted', false, civitas.NOTIFY_RELIGION);
		}
		this.core().save_and_refresh();
		return true;
	};

	/**
	 * Get/set the religion of this settlement.
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.religion = function(value) {
		if (typeof value !== 'undefined') {
			if (typeof value === 'number') {
				this.properties.religion = value;
				return true;
			} else if (typeof value === 'string') {
				const pos = $.inArray(value, civitas.RELIGIONS);
				if (pos !== -1) {
					this.properties.religion = pos;
					return true;
				}
			}
		}
		return {
			id: this.properties.religion,
			name: civitas.RELIGIONS[this.properties.religion].capitalize()
		};
	};

	/**
	 * Raise the faith of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.raise_faith = function(value) {
		if (typeof value === 'undefined') {
			value = 1;
		}
		return this.faith(this.faith() + value);
	};

	/**
	 * Lower the faith of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.lower_faith = function(value) {
		if (typeof value === 'undefined') {
			value = 1;
		}
		return this.faith(this.faith() - value);
	};

	/**
	 * Reset the faith of this settlement.
	 * 
	 * @returns {Number}
	 * @public
	 */
	this.reset_faith = function() {
		return this.faith(civitas.MIN_FAITH_VALUE);
	};

	/**
	 * Get/set the faith of this settlement.
	 * 
	 * @public
	 * @returns {Number}
	 * @param {Number} value
	 */
	this.faith = function(value) {
		if (typeof value !== 'undefined') {
			if (value &lt; civitas.MIN_FAITH_VALUE || this.resources.faith &lt; civitas.MIN_FAITH_VALUE) {
				this.resources.faith = civitas.MIN_FAITH_VALUE;
			} else {
				this.resources.faith = value;
			}
			if (this.resources.faith >= civitas.MAX_FAITH_VALUE) {
				this.resources.faith = civitas.MAX_FAITH_VALUE;
			}
		}
		return this.resources.faith;
	};

	/**
	 * Check if this settlement can recruit soldiers.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.can_research = function() {
		return this.is_building_built('academy');
	};

	/**
	 * Raise the research of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.raise_research = function(amount) {
		if (typeof amount === 'undefined') {
			amount = 1;
		}
		return this.research(this.research() + amount);
	};

	/**
	 * Lower the research of this settlement by the specified amount.
	 * 
	 * @public
	 * @param {Number} amount
	 * @returns {Number}
	 */
	this.lower_research = function(amount) {
		if (typeof amount === 'undefined') {
			amount = 1;
		}
		return this.research(this.research() - amount);
	};

	/**
	 * Reset the research of this settlement.
	 * 
	 * @returns {Number}
	 * @public
	 */
	this.reset_research = function() {
		return this.research(civitas.MIN_RESEARCH_VALUE);
	};

	/**
	 * Get/set the research of this settlement.
	 * 
	 * @public
	 * @returns {Number}
	 * @param {Number} value
	 */
	this.research = function(value) {
		if (typeof value !== 'undefined') {
			if (value &lt; civitas.MIN_RESEARCH_VALUE || this.resources.research &lt; civitas.MIN_RESEARCH_VALUE) {
				this.resources.research = civitas.MIN_RESEARCH_VALUE;
			} else {
				this.resources.research = value;
			}
			if (this.resources.research >= civitas.MAX_RESEARCH_VALUE) {
				this.resources.research = civitas.MAX_RESEARCH_VALUE;
			}
		}
		return this.resources.research;
	};

	/**
	 * Merge resources from a source into settlement's storage.
	 *
	 * @public
	 * @param {Object} resources
	 * @returns {civitas.objects.settlement}
	 */
	this.merge_resources = function(resources) {
		if (typeof resources !== 'undefined') {
			for (let item in resources) {
				if (!civitas.utils.is_virtual_resource(item)) {
					this.add_to_storage(item, resources[item]);
				}
			}
		}
		return this;
	};

	/**
	 * Get resources from the settlement's storage as spoils of war.
	 *
	 * @public
	 * @returns {Object}
	 */
	this.get_spoils = function() {
		const resources = this.get_resources();
		let tmp_res = Object.keys(resources);
		const spoils = {};
		let tmp;
		let resource;
		let random_resource;
		let count = 0;
		while (count &lt; 3) {
			random_resource = tmp_res[Math.floor(Math.random() * tmp_res.length)];
			resource = resources[random_resource];
			if (!civitas.utils.is_virtual_resource(random_resource)) {
				if (resource > 0) {
					if (this.remove_resource(random_resource, resource)) {
						spoils[random_resource] = resource;
						count++;
					}
				}
			}
		}
		return spoils;
	};

	/**
	 * Increase this settlement's coins by the specified amount.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.inc_coins = function(value) {
		return this.coins(this.coins() + value);
	};
		
	/**
	 * Decrease this settlement's coins by the specified amount.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.dec_coins = function(value) {
		if (!this.has_coins(value)) {
			return false;
		}
		this.coins(this.coins() - value);
		return true;
	};
		
	/**
	 * Get/set the coins of the settlement.
	 * 
	 * @public
	 * @param {Number} value
	 * @returns {Number}
	 */
	this.coins = function(value) {
		if (typeof value !== 'undefined') {
			this.resources.coins = value;
		}
		return this.resources.coins;
	};

	/**
	 * Get/set the storage space of this settlement.
	 * 
	 * @public
	 * @param {Object} value
	 * @returns {Object}
	 */
	this.storage = function(value) {
		if (typeof value !== 'undefined') {
			this.properties.storage = value;
		}
		let storage = 0;
		for (let item in this.get_resources()) {
			if (!civitas.utils.is_virtual_resource(item)) {
				storage += this.get_resources()[item];
			}
		}
		return {
			occupied: storage,
			all: this.properties.storage
		};
	};
		
	/**
	 * Adjust the resources according to the settlement owner.
	 *
	 * @private
	 * @returns {civitas.objects.settlement}
	 */
	this._fill_resources = function() {
		for (let item in civitas.RESOURCES) {
			if (typeof this.resources[item] === 'undefined') {
				this.resources[item] = 0;
			}
		}
		return this;
	};

	/**
	 * Add a specified amount of a resource to the storage of this settlement.
	 * 
	 * @public
	 * @param {String} item
	 * @param {Number} amount
	 * @returns {Boolean}
	 */
	this.add_to_storage = function(item, amount) {
		if (!civitas.utils.resource_exists(item)) {
			return false;
		}
		if (!this.has_storage_space_for(item, amount)) {
			return false;
		}
		const res = this.get_resources();
		if (typeof res[item] !== 'undefined') {
			res[item] = res[item] + amount;
		} else {
			res[item] = amount;
		}
		return true;
	};
		
	/**
	 * Check if the settlement has the required coins to create this building.
	 * 
	 * @public
	 * @param {Number} coins
	 * @returns {Boolean}
	 */
	this.has_coins = function(coins) {
		if (this.coins() - coins &lt; 0) {
			if (this.is_player()) {
				this.core().ui().error(this.name() + ' doesn`t have enough ' + civitas.utils.get_resource_name('coins') + '.');
			}
			return false;
		}
		return true;
	};

	/**
	 * Remove the specified resources from the settlement's storage.
	 *
	 * @public
	 * @param {Object} resources
	 * @returns {Boolean}
	 */
	this.remove_resources = function(resources) {
		let good = true;
		for (let item in resources) {
			good = this.remove_resource(item, resources[item]);
			if (good === false) {
				return false;
			}
		}
		return true;
	};

	/**
	 * Remove the amount of specified resource from the settlement's storage.
	 *
	 * @public
	 * @param {String} resource
	 * @param {Number} amount
	 * @returns {Boolean}
	 */
	this.remove_resource = function(resource, amount) {
		const resources = this.get_resources();
		resources[resource] = resources[resource] - amount;
		if (resources[resource] &lt; 0) {
			resources[resource] = 0;
		}
		return true;
	};

	/**
	 * Check if the settlement has storage space for the amount of specified resource.
	 *
	 * @public
	 * @param {String|Object} resources
	 * @param {Number} amount
	 * @returns {Boolean}
	 */
	this.has_storage_space_for = function(resources, amount) {
		let total = 0;
		if (typeof amount === 'undefined') {
			for (let item in resources) {
				if (!civitas.utils.is_virtual_resource(item)) {
					total += resources[item];
				}
			}
		} else {
			if (!civitas.utils.is_virtual_resource(resources)) {
				total += amount;
			}
		}
		let storage = this.storage();
		if ((storage.occupied + total) > storage.all) {
			return false;
		}
		return true;
	};

	/**
	 * Check if the settlement is urban.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.is_urban = function() {
		if (this.is_city() || this.is_metropolis()) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * Check if the settlement has any of the specified resources.
	 *
	 * @public
	 * @param {Object} resources
	 * @returns {Boolean}
	 */
	this.has_any_resources = function(resources) {
		let good = false;
		for (let item in resources) {
			good = this.has_resource(item, resources[item]);
			if (good === true) {
				return item;
			}
		}
		return false;
	};

	/**
	 * Check if the settlement has the specified resources.
	 *
	 * @public
	 * @param {Object} resources
	 * @returns {Boolean}
	 */
	this.has_resources = function(resources) {
		let good = true;
		for (let item in resources) {
			good = this.has_resource(item, resources[item]);
			if (good === false) {
				return false;
			}
		}
		return good;
	};

	/**
	 * Check if the settlement has the amount of specified resource.
	 *
	 * @public
	 * @param {String} resource
	 * @param {Number} amount
	 * @returns {Boolean}
	 */
	this.has_resource = function(resource, amount) {
		const resources = this.get_resources();
		if (!civitas.utils.resource_exists(resource)) {
			return false;
		}
		if (resources[resource] - amount &lt; 0) {
			return false;
		}
		return true;
	};

	/**
	 * Get the resources available in this settlement.
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.get_resources = function() {
		return this.resources;
	};
		
	/**
	 * Set the resources of the settlement.
	 * 
	 * @public
	 * @param {Object} value
	 * @returns {civitas.objects.settlement}
	 */
	this.set_resources = function(value) {
		this.resources = value;
		return this;
	};
	
	/**
	 * Check if this settlement can trade resources.
	 *
	 * @public
	 * @returns {Boolean}
	 */
	this.can_trade = function() {
		return this.is_building_built('tradingpost');
	};

	/**
	 * Buy the specified goods from a settlement.
	 * 
	 * @public
	 * @param {civitas.objects.settlement|String|Number} settlement
	 * @param {String} resource
	 * @param {Number} amount
	 * @param {Boolean} is_auctioneer
	 * @returns {Object|Boolean}
	 */
	this.buy_from_settlement = function(settlement, resource, amount, is_auctioneer) {
		if (!civitas.utils.resource_exists(resource)) {
			if (this.is_player()) {
				this.core().ui().error('The resource you specified does not exist.');
			}
			return false;
		}
		if (this.can_trade()) {
			const resources = this.get_resources();
			let _settlement;
			let discount;
			if (typeof settlement === 'string' || typeof settlement === 'number') {
				_settlement = this.core().get_settlement(settlement);
				if (settlement === false) {
					if (this.is_player()) {
						this.core().ui().error('The settlement of &lt;strong>' + settlement + '&lt;/strong> does not exist.');
					}
					return false;
				}
			} else {
				_settlement = settlement;
				settlement = _settlement.name();
			}
			const is_double = this.religion().id === _settlement.religion().id ? true : false;
			const trades = _settlement.get_trades();
			if (trades === null) {
				if (this.is_player()) {
					this.core().ui().error('The settlement of &lt;strong>' + settlement + '&lt;/strong> does not trade any goods.');
				}
				return false;
			}
			if (typeof trades.exports === 'undefined') {
				if (this.is_player()) {
					this.core().ui().error('The settlement of &lt;strong>' + settlement + '&lt;/strong> does not export any goods.');
				}
				return false;
			}
			for (let item in trades.exports) {
				if (item === resource) {
					if (typeof amount === 'undefined') {
						amount = trades.exports[item];
					}
					discount = Math.ceil((civitas.RESOURCES[item].price * civitas.TRADES_ADDITION) / 100);
					if (typeof is_auctioneer !== 'undefined' &amp;&amp; is_auctioneer === true) {
						discount = Math.ceil(discount + Math.ceil((civitas.RESOURCES[item].price * civitas.AUCTIONEER_DISCOUNT) / 100));
					}
					const price = civitas.utils.calc_price_plus_discount(amount, item, discount);
					const s_price = civitas.utils.calc_price(amount, item);
					const item_discount_price = Math.ceil(civitas.RESOURCES[item].price + discount);
					if (!this.has_storage_space_for(amount)) {
						this.core().ui().error(this.name() + ' does not have enough storage space for &lt;strong>' + amount + '&lt;/strong> ' + civitas.utils.get_resource_name(item) + '.');
						return false;
					}
					if (this.dec_coins(price) === false) {
						return false;
					}
					if (!_settlement.has_resource(item, amount)) {
						return false;
					}
					if (!_settlement.remove_resource(item, amount)) {
						return false;
					}
					_settlement.inc_coins(s_price);
					this.add_to_storage(item, amount);
					this.remove_from_exports(_settlement, item, amount);
					this.raise_influence(_settlement.id(), (is_double ? civitas.IMPORT_INFLUENCE * 2 : civitas.IMPORT_INFLUENCE));
					this.raise_prestige(is_double ? civitas.IMPORT_PRESTIGE * 2 : civitas.IMPORT_PRESTIGE);
					this.raise_fame(civitas.FAME_PER_TRADE);
					this.core().ui().refresh();
					if (this.is_player()) {
						this.core().ui().notify(this.name() + ' bought &lt;strong>' + amount + '&lt;/strong> ' + civitas.utils.get_resource_name(item) + ' from ' + settlement + ' for &lt;strong>' + item_discount_price + '&lt;/strong> ' + civitas.utils.get_resource_name('coins') + ' each, for a total of &lt;strong>' + price + '&lt;/strong> ' + civitas.utils.get_resource_name('coins') + '.', 'World Market');
					}
					return {
						buyer: this.name(),
						amount: amount,
						goods: civitas.utils.get_resource_name(item),
						seller: settlement,
						price: Math.round(civitas.RESOURCES[item].price + discount),
						totalPrice: price
					};
				}
			}
			if (this.is_player()) {
				this.core().ui().error('The settlement of &lt;strong>' + settlement + '&lt;/strong> does not export the requested goods.');
			}
		}
		return false;
	};
		
	/**
	 * Perform a trades reset (resets all amounts of resources available
	 * for trade and randomize the amount.
	 * 
	 * @public
	 * @returns {Boolean}
	 */
	this.reset_trades = function() {
		const data = this.core().generate_random_resources(false, this.get_type());
		let new_resources = data.resources;
		new_resources.coins = this.resources.coins;
		new_resources.fame = this.resources.fame;
		new_resources.prestige = this.resources.prestige;
		new_resources.espionage = this.resources.espionage;
		new_resources.research = this.resources.research;
		new_resources.faith = this.resources.faith;
		this.resources = new_resources;
		if (this.is_urban()) {
			this.trades = data.trades;
		}
		return true;
	};

	/**
	 * Sell the specified goods to a settlement.
	 * 
	 * @public
	 * @param {civitas.objects.settlement|String|Number} settlement
	 * @param {String} resource
	 * @param {Number} amount
	 * @returns {Object|Boolean}
	 */
	this.sell_to_settlement = function(settlement, resource, amount) {
		if (!civitas.utils.resource_exists(resource)) {
			if (this.is_player()) {
				this.core().ui().error('The resource you specified does not exist.');
			}
			return false;
		}
		if (this.can_trade()) {
			const resources = this.get_resources();
			let _settlement;
			if (typeof settlement === 'string' || typeof settlement === 'number') {
				_settlement = this.core().get_settlement(settlement);
				if (settlement === false) {
					if (this.is_player()) {
						this.core().ui().error(settlement + ' does not exist.');
					}
					return false;
				}
			} else {
				_settlement = settlement;
			}
			const is_double = this.religion().id === _settlement.religion().id ? true : false;
			const trades = _settlement.get_trades();
			if (trades === null) {
				if (this.is_player()) {
					this.core().ui().error(settlement + ' does not trade any goods.');
				}
				return false;
			}
			if (typeof trades.imports === 'undefined') {
				if (this.is_player()) {
					this.core().ui().error(settlement + ' does not import any goods.');
				}
				return false;
			}
			for (let item in trades.imports) {
				if (item === resource) {
					if (typeof amount === 'undefined') {
						amount = trades.imports[item];
					}
					const discount = Math.ceil((civitas.RESOURCES[item].price * civitas.TRADES_DISCOUNT) / 100);
					const price = civitas.utils.calc_price_minus_discount(amount, item, discount);
					const s_price = civitas.utils.calc_price(amount, item);
					const item_discount_price = Math.ceil(civitas.RESOURCES[item].price - discount);
					if (!this.has_resource(item, amount)) {
						this.core().ui().error(this.name() + ' does not have enough ' + civitas.utils.get_resource_name(item) + ' to sell.');
						return false;
					}
					if (!this.remove_resource(item, amount)) {
						return false;
					}
					this.inc_coins(price);
					if (!_settlement.dec_coins(s_price)) {
						if (this.is_player()) {
							this.core().ui().error(settlement + ' does not have enough ' + civitas.utils.get_resource_name('coins') + '.');
						}
						return false;
					}
					_settlement.add_to_storage(item, amount);
					this.remove_from_imports(_settlement, item, amount);
					this.raise_influence(_settlement.id(), (is_double ? civitas.EXPORT_INFLUENCE * 2 : civitas.EXPORT_INFLUENCE));
					this.raise_prestige(is_double ? civitas.EXPORT_PRESTIGE * 2 : civitas.EXPORT_PRESTIGE);
					this.raise_fame(civitas.FAME_PER_TRADE);
					this.core().ui().refresh();
					if (this.is_player()) {
						this.core().ui().notify(this.name() + ' sold &lt;strong>' + amount + '&lt;/strong> ' + civitas.utils.get_resource_name(item) + ' to ' + settlement + ' for &lt;strong>' + item_discount_price + '&lt;/strong> ' + civitas.utils.get_resource_name('coins') + ' each, for a total of &lt;strong>' + price + '&lt;/strong> ' + civitas.utils.get_resource_name('coins') + '.', 'World Market');
					}
					return {
						seller: this.name(),
						amount: amount,
						goods: civitas.utils.get_resource_name(item),
						buyer: settlement,
						price: Math.round(civitas.RESOURCES[item].price - discount),
						totalPrice: price
					};
				}
			}
			if (this.is_player()) {
				this.core().ui().error(settlement + ' does not import the specified goods.');
			}
		}
		return false;
	};
		
	/**
	 * Remove a specified amount of a resource from the trade exports of a settlement.
	 * 
	 * @public
	 * @param {civitas.objects.settlement} settlement
	 * @param {String} item
	 * @param {Number} amount
	 * @returns {Boolean}
	 */
	this.remove_from_exports = function(settlement, item, amount) {
		settlement.trades.exports[item] = settlement.trades.exports[item] - amount;
		return true;
	};

	/**
	 * Remove a specified amount of a resource from the trade imports of a settlement.
	 * 
	 * @public
	 * @param {civitas.objects.settlement} settlement
	 * @param {String} item
	 * @param {Number} amount
	 * @returns {Boolean}
	 */
	this.remove_from_imports = function(settlement, item, amount) {
		settlement.trades.imports[item] = settlement.trades.imports[item] - amount;
		return true;
	};

	/**
	 * Get the imports and exports of this settlement.
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.get_trades = function() {
		return this.trades;
	};

	/**
	 * Get the exports of this settlement.
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.get_trades_exports = function() {
		return this.trades.exports;
	};

	/**
	 * Get the imports of this settlement.
	 * 
	 * @public
	 * @returns {Object}
	 */
	this.get_trades_imports = function() {
		return this.trades.imports;
	};

	/**
	 * Format settlement's name into something nicer.
	 *
	 * @public
	 * @returns {String}
	 */
	this.nice_name = function() {
		if (this.is_metropolis()) {
			return 'Metropolis of ' + this.name();
		} else if (this.is_city()) {
			return 'City of ' + this.name();
		} else if (this.is_village()) {
			return 'Village of ' + this.name();
		} else if (this.is_camp()) {
			return 'Raider Camp ' + this.name();
		} else {
			return '';
		}
	};

	/**
	 * Set the imports and exports of this settlement.
	 * 
	 * @public
	 * @param {Object} value
	 * @returns {civitas.objects.settlement}
	 */
	this.set_trades = function(value) {
		this.trades = value;
		return this;
	};

	// Fire up the constructor
	return this.__init(params);
};
</code></pre>
        </article>
    </section>




    
    
</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.2</a> on Thu Jul 18 2019 09:40:21 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>

<script src="scripts/search.js" defer></script>


<script src="scripts/collapse.js" defer></script>


</body>
</html>
